package com.itda.mapper;

import com.itda.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: itda
 * @Date: 2024/4/27 18:55
 * @Description: DeptMapper
 */
@Mapper
public interface DeptMapper {

    /**
     * 查询全部部门
     * @return
     */
    @Select("select * from tlias.dept")
    List<Dept> list();

    /**
     * 根据id删除部门
     * @param id
     */
    @Delete("delete from tlias.dept where id = #{id}")
    void deleteById(Integer id);

    /**
     * 新增部门
     * @param dept
     */
    @Insert("insert into tlias.dept(name, create_time, update_time) values (#{name},#{createTime},#{updateTime})")
    void insert(Dept dept);

    /**
     * 根据id查询部门
     * @param id
     * @return
     */
    @Select("select * from tlias.dept where id = #{id}")
    Dept query(Integer id);

    /**
     * 修改部门
     * @param dept
     */
    @Update("update tlias.dept set name = #{name},update_time = #{updateTime} where id = #{id}")
    void update(Dept dept);
}
